import request from "@/utils/request";

// 热门搜索
export const songDetail = async (ids: string, timestamp: number) => {
  return await request({
    url: `/song/detail?timestamp=${timestamp}`,
    method: "post",
    data: {
      ids: ids,
    },
  });
};

/* ********* 歌曲评论 ********* */
// 歌曲评论
export const commentSong = ({
  id = "",
  limit = 20,
  offset = 0,
  before = 0,
  timestamp = 0,
}) => {
  return request({
    url: `/comment/music?id=${id}&limit=${limit}&offset=${offset}&before=${before}&timestamp=${timestamp}`,
    method: "get",
  });
};
// 获取mv评论
export const commentMv = ({
  id = "",
  limit = 20,
  offset = 0,
  before = 0,
  timestamp = 0,
}) => {
  return request({
    url: `/comment/mv?id=${id}&limit=${limit}&offset=${offset}&before=${before}&timestamp=${timestamp}`,
    method: "get",
  });
};
// 专辑评论
export const albumComment = ({
  id = "",
  limit = 20,
  offset = 0,
  before = 0,
  timestamp = 0,
}) => {
  return request({
    url: `/comment/album?id=${id}&limit=${limit}&offset=${offset}&before=${before}&timestamp=${timestamp}`,
    method: "get",
  });
};
// 获取video评论
export const commentVideo = ({
  id = "",
  limit = 20,
  offset = 0,
  before = 0,
  timestamp = 0,
}) => {
  return request({
    url: `/comment/video?id=${id}&limit=${limit}&offset=${offset}&before=${before}&timestamp=${timestamp}`,
    method: "get",
  });
};

// 获取相似歌曲
export const simiSong = ({ id = "" }) => {
  return request({
    url: `/simi/song?id=${id}`,
    method: "get",
  });
};

// 获取包含歌曲的歌单
export const simiPlayList = ({ id = "" }) => {
  return request({
    url: `/simi/playlist?id=${id}`,
    method: "get",
  });
};

export default {
  commentSong,
  commentMv,
  albumComment,
  commentVideo,
  simiPlayList,
};
